
#ifndef INCLUDED_WIN32SOCKET_H
#define InCLUDED_WIN32SOCKET_H

#include "socket.h"
#include <string>

namespace tinkle {

class Win32Socket : public Socket {
public:
    Win32Socket(int type = SOCK_STREAM);
    ~Win32Socket();

    virtual int Connect(const std::string &host, const std::string &port);
    virtual int _NonTLSRead(char *buf, int len);
    virtual int _NonTLSWrite(const char *buf, int len);

private:
    bool DoConnect();
    bool OnSocketNotify(LPARAM lParam);
    bool OnDNSNotify(WPARAM wParam, LPARAM lParam);
    void UpdateLastError();
    bool SetAsync(long events);
    //SOCKET _sock;
    // socket type, STREAM or DGRAM
    int _type;
    struct sockaddr_in _addr;
    class EventSink;
    EventSink *_sink;
    struct DNSLookUp;
    DNSLookUp *_dns;
    ConnState _state;
};

}

#endif